package com.xdxc.model.dto;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;

import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;
@Data

public class ExamsDTO implements Serializable {
        @JsonSerialize(using = ToStringSerializer.class)
        private Long id;
        @NotBlank(message = "考试标题不能为空")
        private String title;

        private String description;
        private Integer openType;
        private String openTypeDictText;
        private String password;
        private Integer state;

        @NotNull(message = "开始时间不能为空")
        private LocalDateTime startTime;

        @NotNull(message = "结束时间不能为空")
        private LocalDateTime endTime;

        @NotNull(message = "总分不能为空")
        private BigDecimal totalScore;

        @NotNull(message = "考试时长不能为空")
        @Min(value = 1, message = "考试时长至少1分钟")
        private Integer totalTime;

        @NotNull(message = "及格分数不能为空")
        @DecimalMin(value = "0.0", message = "及格分数不能小于0")
        private BigDecimal qualifyScore;
        @NotNull(message = "考试次数不能为空")
        @Min(value = 1, message = "至少允许1次考试机会")
        private Integer chance;
        private Integer answerDevice; // 答题设备限制
        private Boolean camOn; // 是否开启摄像头
        private Integer camInterval; // 摄像头拍照间隔
        private Boolean leaveOn; // 是否开启离开检测
        private Integer leaveCheck; // 离开检测方式
        private Integer leaveCount; // 允许离开次数
        private Boolean actionOn; // 是否开启行为检测
        private Integer actionInterval; // 行为检测间隔
        private Boolean faceOn; // 是否开启人脸识别
        private Boolean faceCheck; // 人脸识别校验
        private Integer faceChance; // 人脸识别失败次数
        private Integer handMin; // 最小交卷时间
        private Integer lateMax; // 最大迟到时间
        private String thanks; // 考试结束感谢语
        private Integer resultType; // 成绩显示类型
        private Integer resultOppty; // 成绩查看机会
        private BigDecimal price; // 考试费用
        private Boolean waterMark; // 是否开启水印
        private Boolean showBook; // 是否显示书签
        private Integer answerMode; // 答题模式
        private Boolean review; // 是否允许复习
        private String deptCode; // 部门编码
        @TableField(fill = FieldFill.INSERT)
        private LocalDateTime createTime;
        @TableField(fill = FieldFill.INSERT_UPDATE)
        private LocalDateTime updateTime;


        @TableField(fill = FieldFill.INSERT)
        private String createBy;
        @TableField(fill = FieldFill.INSERT_UPDATE)
        private String updateBy;
        private String certRules; // 证书规则
        private String pointsRules; // 积分规则

        @JsonSerialize(using = ToStringSerializer.class)
        private Long paperId; // 试卷ID
        private Integer passScore; // 及格分数
        private Integer duration; // 考试时长（秒）


}
